California Current Integrated Ecosystem Assessment Website CCIEA Uploader
  • Uploader
  • Status
name=Array()
data = FileAttachment("data/items_meta.json").json()
pis=data.pis
esr_year=data.esr_year
last_year=data.last_year
{ for(let i=0;i<pis.length;i++){
    name[i]=pis[i].name
    }
  return name
}
components=pis[indx].components
  • View Current Indicators
  • Download Last Year
  • Upload This Year
  • Help
Use this page to view current metadata for each indicator. Does it need editing? Use the second tab: Download Last Year to edit it.
viewof pi = Inputs.select(name,{value:name[0], label: "Choose PI" });
indx=name.indexOf(pi)
viewof component = Inputs.select(components,{format: x => x.name, label: "Component" });
viewof indicator=Inputs.radio(component.indices,{value: component.indices[0]})
meta = await FileAttachment("data/metadata.csv").csv();
filtered = meta.filter(metadata =>{
   return metadata.Title===indicator && metadata.Component_Section===component.name
});
m=filtered[0]
        function year(longdate){
            var datestr=String(longdate);
            if(datestr)return (datestr.replace("-01-01T00:00:00Z",""));
            }
        function yesno(flag){
            return (flag==1) ? "yes" : "no";
            }
        function geterddapurl(id,queryparam,value,variable,type){
            var erddaploc='https://oceanview.pfeg.noaa.gov/erddap/tabledap/';
            var query='';
            if(queryparam!==''&&value!==''){
                query='&'+queryparam+'="'+value+'"';
                if(queryparam=="latitude")query='&'+queryparam+'='+value;
                }
            var url=erddaploc+id+'.'+type+'?time,'+variable+query;
            if(type.search(/png/i)>=0||type.search('graph')>=0){url+='&.draw=lines';}
            return url;
            }


html`
            <div class="vert">
                ${m.default_figure != ""  ? html `<div><img class="blm" src="${m.default_figure}"></iron-image></div>` : html `<div>No image found for this indicator</div>`}
                <div><span>Metadata for <span class="bold">${m.Title}</span>:</span></div>
                <div><span class="bold">Component: </span><span>${m.Component_Section}</span></div>
                <div><span class="bold">Subcomponent: </span><span>${m.Subcomponent}</span></div>
                <div><span class="bold">Dataset Title: </span><span>${m.Dataset_Title}</span></div>
                <div><span class="bold">Indicator Title: </span><span>${m.Title}</span></div>
                <div><span class="bold">Indicator Long Name: </span><span>${m.Long_variable_name}</span></div>
                <div><span class="bold">Background Info: </span><span><a href="${m.Background_Info}" target="_blank">${m.Background_Info}</a></span></div>
                <div><span class="bold">Institution: </span><span>${m.Institution}</span></div>
                <div><span class="bold">Units: </span><span>${m.Units}</span></div>
                <div>
                ${m.region ? html `<span class="bold">Region: </span><span>${m.region}</span>` : html ``}
                ${m.latitude ? html `<span class="bold">Latitude: </span><span>${m.latitude} N</span>` : ``}
                ${m.latitude2 ? html `<span class="bold"> - </span><span>${m.latitude2} N</span>` : ``}
                ${m.longitude ? html `<span class="bold">Longitude: </span><span>${m.longitude} E</span>` : ``}
                ${m.longitude2 ? html `<span class="bold"> - </span><span>${m.longitude2}</span>` : ``}
                </div>
                <div>
                ${m.sampling_frequency ? html `<span class="bold">Sampling frequency: </span><span>${m.Sampling_frequency}</span>` : ``}
                </div>
                <div>
                ${m.Sampling_frequency ? html `<span class="bold">Sampling frequency: </span><span>${m.Sampling_frequency}</span>` : ``}
                </div>
                <div>
                ${m.scientific_name ? html `<span class="bold">Scientific name: </span><span>${m.scientific_name}</span>` : ``}
                </div>
                <div>
                ${m.Source_Data ? html `<span class="bold">Source Data: </span><span>${m.Source_Data}</span>` : ``}
                </div>
                <div>
                ${m.Additional_Calculations ? html `<span class="bold">Additional Calculations: </span><span>${m.Additional_Calculations}</span>` : ``}
                </div>
                <div>
                ${m.filename ? html `<span class="bold">PI filename: </span><span>${m.filename}</span>` : ``}
                </div>
                <div>
                ${m.year_begin ? html `<span class="bold">Date range: </span><span>${year(m.year_begin)} - ${year(m.year_end)}</span>` : ``}
                </div>
                <div>
                ${m.min ? html `<span class="bold">Indicator range: </span><span>min: ${m.min} max: ${m.max}</span>` : ``}
                </div>
                <div>
                <span class="bold">Serve this data for CCIEA? </span><span>${yesno(m.currently_served)}</span> <span class="bold">Whale Entanglement dataset? </span><span>${yesno(m.whale_entanglement_flag)}</span> <span class="bold">Salmon web page? </span><span>${yesno(m.salmon_web_flag)}</span>
                </div>
                <div>
                ${m.no_download_flag ? html `<span class="bold">No download, private data</span>`
                    : html `<span class="bold">ERDDAP data links:</span> <span>(ERDDAP dataset id: ${m.ERDDAP_Dataset_ID}) </span>
                        &nbsp;|&nbsp;<span><a class="noline" href='${geterddapurl(m.ERDDAP_Dataset_ID,m.ERDDAP_query_parameter,m.ERDDAP_query_value,m.ERDDAP_variable_name,"htmlTable")}' target='_blank'>View data as html</a></span>
                        &nbsp;|&nbsp;<span><a class="noline" href='${geterddapurl(m.ERDDAP_Dataset_ID,m.ERDDAP_query_parameter,m.ERDDAP_query_value,m.ERDDAP_variable_name,"csv")}' target='_blank'>Download a csv file</a></span>
                        &nbsp;|&nbsp;<span><a class="noline" href='${geterddapurl(m.ERDDAP_Dataset_ID,m.ERDDAP_query_parameter,m.ERDDAP_query_value,m.ERDDAP_variable_name,"html")}' target='_blank'>ERDDAP link</a></span>
                    `}
                </div>
                <div>
                ${m.last_metadata_update ? html `<span class="bold">Last netadata update: </span><span>${m.last_metadata_update}</span>` : ``}
                
                ${m.last_data_update ? html `<span class="bold">Last data update: </span><span>${m.last_data_update}</span>` : ``}
                </div>
            </div>
        `
Use this page to download csv files of the current data and/or metadata and edit edit as needed.
html`<i>${last_year} metadata and data for PI:</i><b>  ${pis[indx].name} </b><br>Choose a different PI on the View Current Indicators tab`
last_meta='https://oceanview.pfeg.noaa.gov/erddap/tabledap/CCIEA_metadata.csv?dataset_title,indicator_title,long_variable_name,units,info_URL,institution,region,latitude,max_latitude,longitude,max_longitude,sampling_frequency,source_data_summary,additional_calculations,cciea_timeseries_id&currently_served=1&principal_investigator_id="'+pis[indx].id+'"'

viewof lastmeta = Inputs.button("Download "+last_year+" Metadata",{value: pis[indx].this_year, reduce: () => window.open(last_meta)})
html`<i>(This button will directly download a csv file of<b> ${pis[indx].name} ${last_year} Metadata</b>)</i>`
viewof lastyear = Inputs.button("Download "+last_year+" Data",{value: pis[indx].last_year, reduce: () => window.open("https://drive.google.com/drive/folders/"+pis[indx].last_year,"_blank")})
html`<i>(This button opens the Google Drive folder containing<b> ${pis[indx].name} ${last_year} Data</b>)</i>`
Use this page to upload csv files of new data and/or edited metadata as needed.
viewof thisyear = Inputs.button("Upload "+esr_year+" data and metadata",{value: pis[indx].this_year, reduce: () => window.open("https://drive.google.com/drive/folders/"+pis[indx].this_year,"_blank")})
html`<i>(This button opens the Google Drive folder for uploading<b> ${pis[indx].name} ${esr_year} data and metadata</b>)</i>`
ind_url="https://oceanview.pfeg.noaa.gov/erddap/tabledap/CCIEA_metadata.json?&currently_served=1&indicator_title="+'"'+encodeURIComponent(indicator)+'"'
View Current Indicators
  • Select each indicator on the lower part of the page to see the current metadata
    • Is it correct? If so, there’s no need to download last year’s metadata
  • Does your metadata need updating? If so:
    • Go to tab 2: “Download Last Year” to download a csv file of your current metadata
  • Editing your metadata: edit the csv file as needed, but
    • Please keep the column headers as they are.
    • Avoid special characters. We may be able to deal with them but they can cause various issuess
    • If you import the csv file into a spreadsheet application (ie Excel) please export back out as a csv file
  • After you edit the metadata, go to tab 3 “Upload This Year” to go to a Google Drive folder where you can upload the new (csv) metadata
Download Last Year
  • Update your data
    • You can either:
      • download last year’s files and update them
      • or just upload new files (go to tab 3 “Upload This Year”)
    Updating previous files:
    • Go to tab 2: “Upload Last Year” to go to a Google Drive folder where your data from last year is available
    • These files have been converted to standard CCIEA format. All columns in your original data are intact, however the CCIEA columns have been relabeled: “year, index, timeseries, metric, SEup, SElo” for yearly data or “time, index, timeseries, metric, SEup, SElo” for monthly data
    • Update last year’s files or use them as a template for this year
    • Consistent file names from year to year are important. This may mean removing the dates from the file names. The “NAME YOUR FILE LIKE THIS!” button (same as the “PI FILE NAMING CONVENTIONS” button) allows you to view and download a list of CCIEA file naming conventions for your data files. Contact Greg or Lynn if a file name is not listed for one of your data files
Upload This Year
  • Upload your new data
    • When your data is ready to upload (either the updated previous files or new files), go to tab 3 “Upload This Year” to go to a Google Drive folder where you can upload this year’s data and (optionally) edited metadata, both into the same folder
  • Now check your files to make sure they can be automatically ingested. Click button (4) to check the format of your files. A table will appear showing the status of your files. Please re-upload your files after correcting any formatting issues.